---
import { getPayload } from 'payload'
import { config } from 'payload-app'
import Welcome from '../components/Welcome.astro'
import Layout from '../layouts/Layout.astro'

const payload = await getPayload({ config })

const posts = await payload.find({ collection: 'posts', sort: 'createdAt' })
// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build
// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh.
---

<Layout>
  <Welcome posts={posts} />
</Layout>
